---
seotitle: Raw Endpoints
seodesc: Learn how to create raw API endpoints for your cloud backend application using TypeScript and Encore.ts
title: Defining Raw Endpoints
subtitle: Drop down in abstraction to access the raw HTTP request
lang: ts
---

Sometimes you need to operate a lower abstraction than Encore.ts normally provides.
For example, you might want to access the underlying HTTP request, often useful for things like accepting webhooks.

Encore.ts has you covered using "raw endpoints".

To define a raw endpoint, use the `api.raw` function. It works similarly to
`api`, but does not accept a request and response schema. Instead, it works like
the Node.js `http` module and `Express.js`, where the function receives two
parameters: a request object and a response writer.

It looks like this:

```ts
import { api } from "encore.dev/api";

export const myRawEndpoint = api.raw(
  { expose: true, path: "/raw", method: "GET" },
  async (req, resp) => {
    resp.writeHead(200, { "Content-Type": "text/plain" });
    resp.end("Hello, raw world!");
  },
);
```

It can be called like so:

```shell
$ curl http://localhost:4000/raw
Hello, raw world!
```

<GitHubLink
    href="https://github.com/encoredev/examples/tree/main/ts/slack-bot"
    desc="Slack Bot example application that uses Raw endpoints to accept webhooks."
/>

<RelatedDocsLink paths={["/docs/ts/how-to/file-uploads"]} />
